<template>
  <div class="app-container">
    <el-row :gutter="20">
      <!--部门数据-->
      <el-col :span="5" :xs="24">
        <div class="head-container">
          <el-tree
            :data="ouTree"
            :expand-on-click-node="false"
            ref="tree"
            node-key="id"
            lazy
            :props="treeProps"
            :load="getSubTree"
            highlight-current
            :default-expanded-keys="expandKeys"
            @current-change="handleNodeClick"
          />
        </div>
      </el-col>

      <!--用户数据-->
      <el-col :span="19" :xs="24" v-loading="loading">
        <el-form
          :model="queryParams"
          class="queryForm"
          ref="queryForm"
          size="mini"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item prop="name">
            <el-input
              v-model="queryParams.name"
              placeholder="计算机名称"
              clearable
              size="mini"
              @keyup.enter.native="handleQuery"
            >
              <el-select
                v-model="queryParams.searchScope"
                slot="prepend"
                placeholder="搜索范围"
              >
                <el-option label="全局搜索" value="global"></el-option>
                <el-option
                  label="当前组织"
                  value="current"
                ></el-option> </el-select
            ></el-input>
          </el-form-item>

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
            <el-button
              icon="el-icon-download"
              size="mini"
              @click="exportComputerExcel"
              >导出</el-button
            >
            <el-button
              icon="el-icon-download"
              size="mini"
              @click="createDefaultComputer"
              >创建默认计算机</el-button
            >
          </el-form-item>
        </el-form>
        <el-tabs
          type="border-card"
          class="computer-tabs"
          style="height: calc(100vh - 160px)"
          v-model="currentTab"
        >
          <el-tab-pane label="私人计算机">
            <div class="tool-bar" style="margin-bottom: 10px">
              <el-button size="mini" type="primary" @click="showPersonalAddForm"
                >新增</el-button
              >
              <div
                class="toggle"
                style="display: inline-block; cursor: pointer; float: right"
              >
                <el-tag
                  size="mini"
                  :type="
                    peronsalComputer.displayType == 'card' ? 'primary' : 'info'
                  "
                  @click="peronsalComputer.displayType = 'card'"
                >
                  <svg-icon icon-class="list-toggle"
                /></el-tag>
                <el-tag
                  size="mini"
                  :type="
                    peronsalComputer.displayType == 'list' ? 'primary' : 'info'
                  "
                  style="margin-left: 5px"
                  @click="peronsalComputer.displayType = 'list'"
                  ><svg-icon icon-class="list"
                /></el-tag>
              </div>
            </div>
            <el-table
              class="dense-table"
              :data="peronsalComputer.list"
              v-if="peronsalComputer.displayType == 'list'"
            >
              <el-table-column
                label="计算机账号"
                align="left"
                key="name"
                prop="name"
              >
                <template scope="scope">
                  <el-link type="primary" @click="showInfo(scope.row)">{{
                    scope.row.cn
                  }}</el-link>
                </template>
              </el-table-column>

              <el-table-column
                label="计算机名称"
                align="left"
                key="name"
                prop="name"
              />
              <el-table-column label="操作" align="left" width="100px">
                <template slot-scope="{ row }">
                  <el-button
                    v-if="!row.binded && !row.isOld"
                    size="mini"
                    type="text"
                    @click="bind(row.samAccountName)"
                    >绑定</el-button
                  >
                  <el-button
                    v-if="row.binded"
                    size="mini"
                    type="text"
                    @click="unbind(row)"
                    >解绑</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
            <empty
              v-if="!peronsalComputer.list || peronsalComputer.list.length == 0"
            />
            <div
              class="card-wrapper"
              v-if="peronsalComputer.displayType == 'card'"
            >
              <el-card
                v-for="(item, index) in peronsalComputer.list"
                :key="index"
                :class="[{ old: item.isOld }, 'computer-card']"
                shadow="hover"
                :body-style="{ padding: '0px' }"
              >
                <div>
                  <div class="computer-icon">
                    <svg-icon
                      :icon-class="item.binded ? 'screen1' : 'screen2'"
                      style="width: 100%; height: 100%"
                    />
                  </div>
                  <div
                    class="tool"
                    style="padding: 10px 5px; text-align: center"
                  >
                    <el-link type="primary" @click="showInfo(item)">{{
                      item.name
                    }}</el-link>
                  </div>
                  <div style="text-align: center">
                    <el-button
                      v-show="!item.binded && !item.isOld"
                      type="text"
                      class="button"
                      size="mini"
                      @click="bind(item.samAccountName)"
                      >绑定</el-button
                    >
                    <el-button
                      v-show="item.binded"
                      type="text"
                      class="button"
                      size="mini"
                      @click="unbind(item)"
                      >解绑</el-button
                    >
                    <el-button
                      v-show="!item.binded"
                      type="text"
                      class="button"
                      size="mini"
                      style="color: red"
                      @click="delComputer(item.samAccountName)"
                      >删除</el-button
                    >
                  </div>
                </div>
              </el-card>
            </div>
            <pagination
              v-show="peronsalComputer.page.total > 0"
              :total="peronsalComputer.page.total"
              :page.sync="peronsalComputer.page.pageNum"
              :limit.sync="peronsalComputer.page.pageSize"
              @pagination="getData"
            />
          </el-tab-pane>
          <el-tab-pane label="公共计算机">
            <div class="tool-bar" style="margin-bottom: 10px">
              <el-button size="mini" type="primary" @click="showPublicAddForm"
                >新增</el-button
              >
              <div
                class="toggle"
                style="display: inline-block; cursor: pointer; float: right"
              >
                <el-tag
                  size="mini"
                  :type="
                    publicComputer.displayType == 'card' ? 'primary' : 'info'
                  "
                  @click="publicComputer.displayType = 'card'"
                >
                  <svg-icon icon-class="list-toggle"
                /></el-tag>
                <el-tag
                  size="mini"
                  :type="
                    publicComputer.displayType == 'list' ? 'primary' : 'info'
                  "
                  style="margin-left: 5px"
                  @click="publicComputer.displayType = 'list'"
                  ><svg-icon icon-class="list"
                /></el-tag>
              </div>
            </div>
            <el-table
              class="dense-table"
              :data="publicComputer.list"
              v-if="publicComputer.displayType == 'list'"
            >
              <el-table-column
                label="计算机账号"
                align="left"
                key="name"
                prop="name"
              >
                <template scope="scope">
                  <el-link type="primary" @click="showInfo(scope.row)">{{
                    scope.row.cn
                  }}</el-link>
                </template>
              </el-table-column>

              <el-table-column
                label="计算机名称"
                align="left"
                key="name"
                prop="name"
              />
              <el-table-column label="操作" align="left" width="100px">
                <template slot-scope="{ row }">
                  <el-button
                    size="mini"
                    type="text"
                    style="color: red"
                    @click="delComputer(row.samAccountName)"
                    >删除</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
            <empty
              v-if="!publicComputer.list || publicComputer.list.length == 0"
            />
            <div
              class="card-wrapper"
              v-if="publicComputer.displayType == 'card'"
            >
              <el-card
                v-for="(item, index) in publicComputer.list"
                :key="index"
                class="computer-card"
                shadow="hover"
                :body-style="{ padding: '0px' }"
              >
                <div>
                  <div class="computer-icon">
                    <svg-icon
                      :icon-class="item.binded ? 'screen1' : 'screen2'"
                      style="width: 100%; height: 100%"
                    />
                  </div>
                  <div
                    class="tool"
                    style="padding: 10px 5px; text-align: center"
                  >
                    <el-link type="primary" @click="showInfo(item)">{{
                      item.name
                    }}</el-link>
                  </div>
                  <div style="text-align: center">
                    <el-button
                      type="text"
                      class="button"
                      size="mini"
                      style="color: red"
                      @click="delComputer(item.samAccountName)"
                      >删除</el-button
                    >
                  </div>
                </div>
              </el-card>
            </div>
            <pagination
              v-show="publicComputer.page.total > 0"
              :total="publicComputer.page.total"
              :page.sync="publicComputer.page.pageNum"
              :limit.sync="publicComputer.page.pageSize"
              @pagination="getData"
            />
          </el-tab-pane>
        </el-tabs>
      </el-col>
    </el-row>
    <!-- 用户详情抽屉 -->
    <el-drawer
      :withHeader="false"
      size="600px"
      v-if="currentComputer"
      :visible.sync="computerDetailDrawerVisible"
      direction="rtl"
      :append-to-body="true"
      :modal-append-to-body="true"
      :modal="false"
    >
      <div
        class="info-container"
        style="padding: 50px 15px; height: 100%"
        v-loading="infoLoading"
      >
        <Description-form :data="currentComputer">
          <Description-item label="计算机名称" prop="name" />
          <Description-item label="计算机位置" prop="distinguishedName" />
          <Description-item label="创建时间" prop="whenCreated" />
          <Description-item label="操作系统" prop="operatingSystem" />
          <Description-item label="设备版本" prop="operatingSystemVersion">
          </Description-item>
          <Description-item label="已绑定用户">
            <template>
              <div
                style="display: flex; justify-content: space-between"
                v-for="(person, index) in currentComputer.bindUsers"
                :key="index"
              >
                <span style="margin-right: 20px">{{
                  person.samAccountName
                }}</span>
                <span>{{ person.fullDepartment }}</span>
              </div>
            </template>
          </Description-item>
        </Description-form>
      </div>
    </el-drawer>
    <el-dialog
      title="添加私人计算机"
      width="550px"
      :visible.sync="peronsalComputer.addFormVisible"
      @closed="resetAddForm"
    >
      <!-- @submit.native.prevent
      @keyup.enter="searchPerson" -->
      <el-form
        ref="addPersonalComputerForm"
        style="width: 400px; margin: 0 auto"
        :model="peronsalComputer.addForm"
        label-width="80px"
        :rules="{
          personName: [
            {
              required: true,
              message: '请输入账号或用户名进行搜索',
              trigger: 'blur',
            },
          ],
          computerName: [
            {
              required: true,
              message: '请选择用户生成计算机名',
              trigger: 'blur',
            },
          ],
        }"
      >
        <el-form-item label="账号" prop="personName">
          <el-input
            v-model="peronsalComputer.addForm.personName"
            autocomplete="off"
            placeholder="账号或用户名"
            :validate-event="false"
          >
            <!-- color: #FFFFFF;
    background-color: #1890ff;
    border-color: #1890ff; -->
            <template slot="append"
              ><el-button
                icon="el-icon-search"
                type="primary"
                style=""
                @click="searchPerson"
                >检测</el-button
              ></template
            >
          </el-input>
        </el-form-item>
        <el-dialog
          width="600px"
          title="选择人员"
          :visible.sync="peronsalComputer.addForm.searchPersonResult.show"
          :append-to-body="true"
          :modal-append-to-body="true"
        >
          <template>
            <el-table
              size="mini"
              height="250px"
              highlight-current-row
              empty-text="未找到符合条件的数据"
              @current-change="handleCurrentRowChanged"
              :data="peronsalComputer.addForm.searchPersonResult.list"
            >
              <el-table-column
                label="账号"
                width="150px"
                prop="samAccountName"
              />
              <el-table-column label="显示名" prop="displayName" />
              <el-table-column
                label="部门"
                width="300px"
                prop="fullDepartment"
              />
            </el-table>
            <pagination
              style="text-align: right"
              :total="peronsalComputer.addForm.searchPersonResult.page.total"
              small
              layout="prev, pager, next"
              :page.sync="
                peronsalComputer.addForm.searchPersonResult.page.pageNum
              "
              :limit.sync="
                peronsalComputer.addForm.searchPersonResult.page.pageSize
              "
              @pagination="searchPerson"
            />
            <div slot="footer" class="dialog-footer">
              <el-button
                @click="
                  peronsalComputer.addForm.searchPersonResult.show = false
                "
                >取 消</el-button
              >
              <el-button type="primary" @click="confirmSelectPerson()"
                >确 定</el-button
              >
            </div>
          </template>
        </el-dialog>
        <el-form-item
          label="用户组织"
          v-if="peronsalComputer.addForm.fullDepartment"
        >
          <span>{{ peronsalComputer.addForm.fullDepartment }}</span>
        </el-form-item>

        <el-form-item label="计算机名" prop="computerName">
          <el-input
            v-model="peronsalComputer.addForm.computerName"
            autocomplete="off"
            readonly
            :validate-event="false"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="peronsalComputer.addFormVisible = false"
          >取 消</el-button
        >
        <el-button type="primary" @click="handleCreatePersonComputer()"
          >确 定</el-button
        >
      </div>
    </el-dialog>

    <el-dialog
      title="添加公共计算机"
      width="550px"
      :visible.sync="publicComputer.addFormVisible"
    >
      <el-form
        ref="addPublicComputerForm"
        style="width: 400px; margin: 0 auto"
        :model="publicComputer.addForm"
        label-width="80px"
        :rules="{
          computerName: [
            {
              required: true,
              message: '请输入计算机名',
              trigger: 'blur',
            },
          ],
        }"
      >
        <el-form-item label="当前组织">
          <span>{{ this.queryParams.ou }}</span>
        </el-form-item>
        <el-form-item label="计算机名" prop="computerName">
          <el-input
            v-model="publicComputer.addForm.computerName"
            autocomplete="off"
            placeholder="最大长度15位,不能包含$"
          >
          </el-input> </el-form-item
      ></el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="publicComputer.addFormVisible = false"
          >取 消</el-button
        >
        <el-button type="primary" @click="handleCreatePublicComputer()"
          >确 定</el-button
        >
      </div></el-dialog
    >
  </div>
</template>

<script>
import computerApi from "@/api/activeDirectory/computer";
import personApi from "@/api/activeDirectory/person";
import { orgMixin } from "../mixin/org";
export default {
  name: "manageComputer",
  mixins: [orgMixin],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户表格数据
      userList: null,
      // 弹出层标题
      title: "",

      currentTab: 0,
      // 是否显示弹出层
      open: false,
      // 部门名称
      deptName: undefined,
      // 默认密码
      initPassword: undefined,
      // 日期范围
      dateRange: [],
      // 状态数据字典
      statusOptions: [],
      // 性别状态字典
      sexOptions: [],
      // 岗位选项
      postOptions: [],
      // 角色选项
      roleOptions: [],
      // 表单参数
      form: {},
      currentComputer: undefined,
      computerDetailDrawerVisible: false,
      queryParams: {
        name: undefined,
        cn: undefined,
        ou: undefined,
        dn: undefined,
        searchScope: "current",
      },
      peronsalComputer: {
        list: [],
        page: {
          pageNum: 1,
          pageSize: 10,
          total: 0,
        },
        displayType: "card",
        addFormVisible: false,
        addForm: {
          personName: "",
          searchPersonResult: {
            show: false,
            loading: false,
            list: [],
            currentRow: undefined,
            page: { pageNum: 1, pageSize: 5, total: 0 },
          },
          computerName: "",
          fullDepartment: "",
        },
      },

      publicComputer: {
        list: [],
        page: {
          pageNum: 1,
          pageSize: 10,
          total: 0,
        },
        addFormVisible: false,
        displayType: "card",
        addForm: {
          computerName: "",
        },
      },
      infoLoading: false,
    };
  },
  watch: {
    // 根据名称筛选部门树
    deptName(val) {
      this.$refs.tree.filter(val);
    },
    currentTab(newVal) {
      if (!this.queryParams.dn) return;
      this.getData();
    },
  },
  mounted() {},
  methods: {
    /** 查询用户列表 */
    async getData() {
      try {
        this.loading = true;
        if (
          this.queryParams.searchScope == "global" &&
          !this.queryParams.name
        ) {
          this.$message.warning("全局搜索必须输入查询条件！");
          return;
        }
        if (this.currentTab == 0) {
          await this.getPersonalComputers();
        } else {
          await this.getPublicComputers();
        }
      } catch (e) {
      } finally {
        this.loading = false;
      }
    },
    // 导出
    exportComputerExcel() {
      this.loading = true;
      computerApi
        .exportExcel(this.queryParams)
        .then((res) => {
          const content = res.data;
          const blob = new Blob([content], {
            type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8",
          });
          var headerVal = res.headers["content-disposition"].split(";")[1];
          const fileName = headerVal.substr("filename=".length + 1);
          if (navigator.msSaveBlob) {
            navigator.msSaveBlob(blob, fileName);
          } else {
            let url = window.URL.createObjectURL(blob);
            const link = document.createElement("a");
            link.href = url;
            link.download = fileName;
            link.click();
            url.revokeObjectURL(link.href);
          }
        })
        .catch()
        .finally((n) => {
          this.loading = false;
        });
    },
    async getPersonalComputers() {
      const res = await computerApi.personalPageList({
        ...this.peronsalComputer.page,
        ...this.queryParams,
      });
      console.log(res);
      if (res.success) {
        this.peronsalComputer.list = res.data.data;
        this.peronsalComputer.page.total = res.data.pagination.dataCount;
      }
    },
    async getPublicComputers() {
      const res = await computerApi.publicPageList({
        ...this.publicComputer.page,
        ...this.queryParams,
      });
      if (res.success) {
        this.publicComputer.list = res.data.data;
        this.publicComputer.page.total = res.data.pagination.dataCount;
      }
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    async bind(samAccountName) {
      this.loading = true;
      const res = await computerApi
        .bind(samAccountName)
        .catch()
        .finally((n) => {
          this.loading = false;
        });
      if (res.success) {
        this.$message.success("绑定成功！");
        this.getData();
      }
    },

    async unbind({ samAccountName, name, binded, isOld }, type = "personal") {
      if (type == "personal" && binded && isOld) {
        this.$confirm(
          `计算机【${name}】为历史数据，解绑后无法重新绑定，请谨慎操作？`,
          "提示",
          {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          }
        ).then(() => {
          this.doUnbindRequest(samAccountName, type);
        });
      } else {
        this.doUnbindRequest(samAccountName, type);
      }
    },

    async doUnbindRequest(samAccountName, type) {
      this.loading = true;
      const res = await computerApi
        .unbind(samAccountName, type)
        .catch()
        .finally((n) => {
          this.loading = false;
        });
      if (res.success) {
        this.$message.success("解绑成功！");
        this.getData();
      }
    },
    // 节点单击事件
    handleNodeClick(node) {
      this.queryParams.cn = node.data.cn;
      this.queryParams.ou = node.data.ou;
      this.queryParams.dn = node.data.distinguishedName;
      this.queryParams.searchScope = "current";
      this.getData();
    },

    showPersonalAddForm() {
      this.peronsalComputer.addFormVisible = true;

      this.$nextTick(() => {
        this.$refs["addPersonalComputerForm"].clearValidate();
        this.$refs["addPersonalComputerForm"].resetFields();
      });
    },

    showPublicAddForm() {
      this.publicComputer.addFormVisible = true;
      this.$nextTick(() => {
        this.$refs["addPublicComputerForm"].clearValidate();
        this.$refs["addPublicComputerForm"].resetFields();
      });
    },
    //添加公共计算机
    async handleCreatePublicComputer() {
      this.$refs["addPublicComputerForm"].validate(async (valid) => {
        if (valid) {
          console.log(this.queryParams);
          const res = await computerApi.createPublicComputer(
            this.queryParams.dn,
            this.publicComputer.addForm.computerName
          );
          if (res.success) {
            this.publicComputer.addFormVisible = false;
            this.$message.success("创建成功");
            this.getData();
          }
        }
      });
    },

    //添加私人计算机
    async handleCreatePersonComputer() {
      this.$refs["addPersonalComputerForm"].validate(async (valid) => {
        if (valid) {
          const res = await computerApi.createPersonComputer(
            this.peronsalComputer.addForm.personName
          );
          if (res.success) {
            this.peronsalComputer.addFormVisible = false;
            this.$message.success("创建成功");
            this.getData();
          }
        }
      });
    },

    //删除计算机
    async delComputer(name) {
      this.$confirm(`确定删除计算机【${name}】吗？`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(async () => {
        this.loading = true;
        const res = await computerApi
          .deleteComputer(name)
          .catch()
          .finally((n) => {
            this.loading = false;
          });
        if (res.success) {
          this.$message.success("删除成功");
          this.getData();
        }
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        userId: undefined,
        deptId: undefined,
        userName: undefined,
        nickName: undefined,
        password: undefined,
        phonenumber: undefined,
        email: undefined,
        sex: undefined,
        status: "0",
        remark: undefined,
        postIds: [],
        roleIds: [],
      };
      this.resetForm("form");
    },

    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.single = selection.length != 1;
      this.multiple = !selection.length;
    },

    //搜索人员表格行切换
    handleCurrentRowChanged(current, old) {
      this.peronsalComputer.addForm.searchPersonResult.currentRow = current;
    },
    //查看详细信息
    async showInfo(row) {
      this.computerDetailDrawerVisible = true;
      this.infoLoading = true;
      const res = await computerApi
        .info(row.samAccountName)
        .catch()
        .finally((n) => {
          this.infoLoading = false;
        });
      if (res.success) {
        this.currentComputer = res.data;
      }
    },
    //搜索人员
    async searchPerson() {
      // this.$refs["addPersonalComputerForm"].validate(valid => {
      //   if (!valid) {
      //     return false;
      //   }
      // });

      if (!this.peronsalComputer.addForm.personName) return;
      this.peronsalComputer.addForm.searchPersonResult.loading = true;

      const queryParams = {
        ...this.peronsalComputer.addForm.searchPersonResult.page,
        displayName: this.peronsalComputer.addForm.personName,
      };
      const res = await personApi
        .searchPersonPage(queryParams)
        .catch()
        .finally(
          (n) =>
            (this.peronsalComputer.addForm.searchPersonResult.loading = false)
        );
      if (res.success) {
        if (res.data.data.length > 1) {
          this.peronsalComputer.addForm.searchPersonResult.show = true;
          this.peronsalComputer.addForm.searchPersonResult.list = res.data.data;
          this.peronsalComputer.addForm.searchPersonResult.page.total =
            res.data.pagination.dataCount;
        } else if (res.data.data.length == 1) {
          this.peronsalComputer.addForm.searchPersonResult.currentRow =
            res.data.data[0];
          this.confirmSelectPerson();
        } else if (res.data.data == 0) {
          this.$message.warning("未找到符合条件的用户！");
          this.peronsalComputer.addForm.computerName = "";
        }
      }
    },

    //确认选择人员 生成计算机名
    async confirmSelectPerson() {
      if (!this.peronsalComputer.addForm.searchPersonResult.currentRow) {
        this.$message.warning("请选择人员！");
        return;
      }
      let row = this.peronsalComputer.addForm.searchPersonResult.currentRow;
      this.peronsalComputer.addForm.personName = row.samAccountName;
      this.peronsalComputer.addForm.fullDepartment = row.fullDepartment;

      this.peronsalComputer.addForm.searchPersonResult.show = false;
      const res = await computerApi.generateComputerName(row.samAccountName);
      if (res.success) {
        this.peronsalComputer.addForm.computerName = res.data;
      }
    },
    //通用
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
      this.getData();
    },
    resetAddForm() {
      this.peronsalComputer.addForm = {
        personName: "",
        searchPersonResult: {
          show: false,
          loading: false,
          list: [],
          currentRow: undefined,
          page: { pageNum: 1, pageSize: 5, total: 0 },
        },
        computerName: "",
      };
      this.publicComputer.addForm = {
        computerName: "",
      };
    },
    //创建私人计算机
    async createDefaultComputer() {
      const res = await computerApi.createDefaultComputer().catch();
      if (res && res.success) {
        this.$message.success("创建成功");
      }
    },
  },
};
</script>
<style lang="scss" scoped>
@import "./style/computerCard.scss";
.app-container {
  ::v-deep .el-table {
    height: calc(100vh - 350px);
  }
}
.head-container {
  max-height: calc(100vh - 100px);
  overflow: auto;
}

#AdUserDetail {
  .info-container {
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
      "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    color: #606266;

    .info-group-header {
      border-left-color: #409eff;
      border-left-width: 5px;
      border-radius: 3px;
      border-left-style: solid;
      padding-left: 6px;
    }
    .info-item {
      margin: 15px;
      .info-label {
        display: inline-block;
        min-width: 100px;
        text-align: right;
        margin-right: 5px;
        font-weight: bold;
        color: #303133;
      }
      &.inline {
        display: inline-block;
        width: 40%;
        margin: 0px;
        margin-right: 15px;
      }
    }
  }
}
</style>
